#ifndef GLOBAL_VAR_H
#define GLOBAL_VAR_H
#include <QMutex>
#include <QDebug>

#include <QFileDialog>
#include <QMessageBox>
#include <QRegularExpression>
typedef unsigned char    BOOLEAN;
typedef unsigned char    INT8U;                    /* Unsigned  8 bit quantity                           */
typedef signed   char    INT8S;                    /* Signed    8 bit quantity                           */
typedef unsigned short   INT16U;                   /* Unsigned 16 bit quantity                           */
typedef signed   short   INT16S;                   /* Signed   16 bit quantity                           */
typedef unsigned int     INT32U;                   /* Unsigned 32 bit quantity                           */
typedef signed   int     INT32S;                   /* Signed   32 bit quantity                           */
typedef unsigned long long   INT64U;
typedef long long   INT64S;
typedef float            FP32;                     /* Single precision floating point                    */
typedef double           FP64;                     /* Double precision floating point                    */
#define TRUE  1
#define FALSE  0
#define RECE_FRAME_HEAD           9
#define RECE_FRAME_LEN              4096
#define RESPONSE_FRAME_LEN     4096


#define SIZE_OF_APP_PROTOCOL_FRAME  2100
#define SAL_ADD_SIZE    256

typedef struct {
    INT8U item[4];
    QString  itemName;
}Item_str;

typedef struct {
    Item_str  item;
    INT8U addr[6];
}sendItemRes;


#define  READADDR       0x1
#define  READDOC        0x2
#define  READDOCNEXT    0x3
#define  READDATE       0x4
#define  READDATE_TX    0x05   //读取通信单元的数据，协议一致性

//通信单元抄读数据项数组
#define   ITEMAX_TX       17
extern Item_str  item645_TX[ITEMAX_TX];

//监测单元抄读数据项数组
#define   ITEMAX       7
extern Item_str  item645_JC[ITEMAX];



typedef struct
{
    char receive_head[RECE_FRAME_HEAD];
    char recevice_frame_waite[RECE_FRAME_LEN];
    char  recevice_frame[RECE_FRAME_LEN];
    char receive_state;
    char response_frame[RESPONSE_FRAME_LEN];
    int receive_len;
     int receive_len_raw;
    int response_len;
    int userdata_pos;
    int  need_show_flag;
    int  need_show_AFN,need_show_FN,need_show_subFn;
}channel_param;
extern channel_param   serial_channel;
extern QMutex  mutexUart;   //互斥量保护了串口收发的正确性。

//响应对象
typedef struct{
    INT32U    time;
    //pFunResponseRelease    release;
    void     *pChannel;
    void    (* CallBack)(void);
    INT8U     channel;
    INT8U     state;
    INT8U     protocol_type;
    BOOLEAN   auto_release;
    INT8U     work_flag[10];    //协议处理中保存一些处理状态
    INT16U    pos;
    INT16U    max_reply_pos;
    INT16U    frame_len;
    INT8U     release_flag;      //释放标志，防止多次释放 0xAA:已经释放，其它未释放
    INT8U     userdata_pos;
    INT8U     recv_frame[4+SIZE_OF_APP_PROTOCOL_FRAME+SAL_ADD_SIZE];//由于采用sal后报文会变长，会变长多少还无法确认，因此这里额外增加256字节，具体值需要咨询芯片厂家后确认
    INT8U     *frame;
    INT8U     sal_info[60];
    INT8U     is_report;          //SAL使用，0xAA表示主动上报，其他表示不是主动上报
}objResponse;

//应用请求对象
typedef struct {
    INT32U   time_in_10ms;
//    void    *pChannel;
//    void    (* CallBack)(void);
    INT8U    channel;
    INT8U    state;
    INT8U    protocol_type;
    INT8U    u8;
    INT16U   cs;
    INT16U   pos;
    INT16U   userDataLen;
    INT16U   frame_len;
    INT8U    *param;
    INT8U    *context;
    INT8U    *fn;
    objResponse *pResp;     //当前关联response对象
    //tagProtocolFlag protocol_flag;
    INT8U    send_frame[SIZE_OF_APP_PROTOCOL_FRAME];
    INT8U    *frame;
    INT8U    phy_count; //fn内物理量个数
    INT8U    rseq;//应答报文的帧序号
    INT8U    userdata_pos;
    INT16U   addition_pos;
    BOOLEAN  is_security;
    BOOLEAN  is_sal;
    BOOLEAN  is_cymeter_frame;
    INT8U    security_info[30];//[0]-报文类别，0-明文 1-密文，[1]-解密结果，0-成功，其它-失败  [2]-数据验证信息，0-SID_MAC，1-RN，2-RN_MAC，3-SID
    INT32U           send_time_in_10ms;
    INT32U           recv_time_in_10ms;
    INT8U            recv_success_flag;
}objRequest;
#define AFN_ACK            0x00     //确认/否认 以及终端对所请求的数据不具备响应条件的否认回答
#define AFN_RESET          0x01     //复位命令
#define AFN_TEST           0x02     //链路接口检测,适用于交换网络传输信道
#define AFN_FEP            0x03     //中继站命令
#define AFN_SET            0x04     //设置参数
#define AFN_CTRL           0x05     //控制命令
#define AFN_AUTH           0x06     //密钥协商
#define AFN_ASK_SLAVE      0x08     //请求被级联终端主动上报
#define AFN_READCFG        0x09     //请求终端配置
#define AFN_QUERY          0x0A     //查询参数
#define AFN_READTASK       0x0B     //请求任务数据
#define AFN_READCUR        0x0C     //请求1类数据（实时数据）
#define AFN_READHIS        0x0D     //请求2类数据（历史数据）
#define AFN_READEVENT      0x0E     //请求3类数据（事件数据）
#define AFN_FTP            0x0F     //文件传输
#define AFN_RELAY          0x10     //数据转发
#define AFN_ASK_SLAVE_NEXT 0x18     //继续请求从终端上报数据(作为从终端，应该等待该报文后才能继续发送数据)
#define AFN_PATCH_READHIS  0x1d     //补抄 2类数据
#define AFN_DEBUG          0xFE     //厂家调试
#define FUNC_MASK_CLIENT    0x80       //设置传送方向
#define FUNC_MASK_DENY      0x40       //设置否定标志


//信息类
#define DT_F0   0x0000

#define DT_F1   0x0001
#define DT_F2   0x0002
#define DT_F3   0x0004
#define DT_F4   0x0008
#define DT_F5   0x0010
#define DT_F6   0x0020
#define DT_F7   0x0040
#define DT_F8   0x0080

#define DT_F9   0x0101
#define DT_F10  0x0102
#define DT_F11  0x0104
#define DT_F12  0x0108
#define DT_F13  0x0110
#define DT_F14  0x0120
#define DT_F15  0x0140
#define DT_F16  0x0180


#define DT_F17  0x0201
#define DT_F18  0x0202
#define DT_F19  0x0204
#define DT_F20  0x0208
#define DT_F21  0x0210
#define DT_F22  0x0220
#define DT_F23  0x0240
#define DT_F24  0x0280


#define DT_F25  0x0301
#define DT_F26  0x0302
#define DT_F27  0x0304
#define DT_F28  0x0308
#define DT_F29  0x0310
#define DT_F30  0x0320
#define DT_F31  0x0340
#define DT_F32  0x0380


#define DT_F33  0x0401
#define DT_F34  0x0402
#define DT_F35  0x0404
#define DT_F36  0x0408
#define DT_F37  0x0410
#define DT_F38  0x0420
#define DT_F39  0x0440
#define DT_F40  0x0480

#define DT_F41  0x0501
#define DT_F42  0x0502
#define DT_F43  0x0504
#define DT_F44  0x0508
#define DT_F45  0x0510
#define DT_F46  0x0520
#define DT_F47  0x0540
#define DT_F48  0x0580


#define DT_F49  0x0601
#define DT_F50  0x0602
#define DT_F51  0x0604
#define DT_F52  0x0608
#define DT_F53  0x0610
#define DT_F54  0x0620
#define DT_F55  0x0640
#define DT_F56  0x0680


#define DT_F57  0x0701
#define DT_F58  0x0702
#define DT_F59  0x0704
#define DT_F60  0x0708
#define DT_F61  0x0710
#define DT_F62  0x0720
#define DT_F63  0x0740
#define DT_F64  0x0780

#define DT_F65  0x0801
#define DT_F66  0x0802
#define DT_F67  0x0804
#define DT_F68  0x0808
#define DT_F69  0x0810
#define DT_F70  0x0820
#define DT_F71  0x0840
#define DT_F72  0x0880

#define DT_F657 0x0805
#define DT_F668 0x080A


#define DT_F73  0x0901
#define DT_F74  0x0902
#define DT_F75  0x0904
#define DT_F76  0x0908
#define DT_F77  0x0910
#define DT_F78  0x0920
#define DT_F79  0x0940
#define DT_F80  0x0980


#define DT_F81  0x0A01
#define DT_F82  0x0A02
#define DT_F83  0x0A04
#define DT_F84  0x0A08
#define DT_F85  0x0A10
#define DT_F86  0x0A20
#define DT_F87  0x0A40
#define DT_F88  0x0A80

#define DT_F89  0x0B01
#define DT_F90  0x0B02
#define DT_F91  0x0B04
#define DT_F92  0x0B08
#define DT_F93  0x0B10
#define DT_F94  0x0B20
#define DT_F95  0x0B40
#define DT_F96  0x0B80


#define DT_F97   0x0C01
#define DT_F98   0x0C02
#define DT_F99   0x0C04
#define DT_F100  0x0C08
#define DT_F101  0x0C10
#define DT_F102  0x0C20
#define DT_F103  0x0C40
#define DT_F104  0x0C80

#define DT_F105  0x0D01
#define DT_F106  0x0D02
#define DT_F107  0x0D04
#define DT_F108  0x0D08
#define DT_F109  0x0D10
#define DT_F110  0x0D20
#define DT_F111  0x0D40
#define DT_F112  0x0D80

#define DT_F113  0x0E01
#define DT_F114  0x0E02
#define DT_F115  0x0E04
#define DT_F116  0x0E08
#define DT_F117  0x0E10
#define DT_F118  0x0E20
#define DT_F119  0x0E40
#define DT_F120  0x0E80

#define DT_F121  0x0F01
#define DT_F122  0x0F02
#define DT_F123  0x0F04
#define DT_F124  0x0F08
#define DT_F125  0x0F10
#define DT_F126  0x0F20
#define DT_F127  0x0F40
#define DT_F128  0x0F80

#define DT_F129  0x1001
#define DT_F130  0x1002
#define DT_F131  0x1004
#define DT_F132  0x1008
#define DT_F133  0x1010
#define DT_F134  0x1020
#define DT_F135  0x1040
#define DT_F136  0x1080


#define DT_F137  0x1101
#define DT_F138  0x1102
#define DT_F139  0x1104
#define DT_F140  0x1108
#define DT_F141  0x1110
#define DT_F142  0x1120
#define DT_F143  0x1140
#define DT_F144  0x1180


#define DT_F145  0x1201
#define DT_F146  0x1202
#define DT_F147  0x1204
#define DT_F148  0x1208
#define DT_F149  0x1210
#define DT_F150  0x1220
#define DT_F151  0x1240
#define DT_F152  0x1280

#define DT_F153  0x1301
#define DT_F154  0x1302
#define DT_F155  0x1304
#define DT_F156  0x1308
#define DT_F157  0x1310
#define DT_F158  0x1320
#define DT_F159  0x1340
#define DT_F160  0x1380


#define DT_F161  0x1401
#define DT_F162  0x1402
#define DT_F163  0x1404
#define DT_F164  0x1408
#define DT_F165  0x1410
#define DT_F166  0x1420
#define DT_F167  0x1440
#define DT_F168  0x1480

#define DT_F169  0x1501
#define DT_F170  0x1502
#define DT_F171  0x1504
#define DT_F172  0x1508
#define DT_F173  0x1510
#define DT_F174  0x1520
#define DT_F175  0x1540
#define DT_F176  0x1580


#define DT_F177  0x1601
#define DT_F178  0x1602
#define DT_F179  0x1604
#define DT_F180  0x1608
#define DT_F181  0x1610
#define DT_F182  0x1620
#define DT_F183  0x1640
#define DT_F184  0x1680

#define DT_F185  0x1701
#define DT_F186  0x1702
#define DT_F187  0x1704
#define DT_F188  0x1708
#define DT_F189  0x1710
#define DT_F190  0x1720
#define DT_F191  0x1740
#define DT_F192  0x1780

#define DT_F193  0x1801
#define DT_F194  0x1802
#define DT_F195  0x1804
#define DT_F196  0x1808
#define DT_F197  0x1810
#define DT_F198  0x1820
#define DT_F199  0x1840
#define DT_F200  0x1880


#define DT_F201  0x1901
#define DT_F202  0x1902
#define DT_F203  0x1904
#define DT_F204  0x1908
#define DT_F205  0x1910
#define DT_F206  0x1920
#define DT_F207  0x1940
#define DT_F208  0x1980



#define DT_F209  0x1A01
#define DT_F210  0x1A02
#define DT_F211  0x1A04
#define DT_F212  0x1A08
#define DT_F213  0x1A10
#define DT_F214  0x1A20
#define DT_F215  0x1A40
#define DT_F216  0x1A80



#define DT_F217  0x1B01
#define DT_F218  0x1B02
#define DT_F219  0x1B04
#define DT_F220  0x1B08
#define DT_F221  0x1B10
#define DT_F222  0x1B20
#define DT_F223  0x1B40
#define DT_F224  0x1B80


#define DT_F225  0x1C01
#define DT_F226  0x1C02
#define DT_F227  0x1C04
#define DT_F228  0x1C08
#define DT_F229  0x1C10
#define DT_F230  0x1C20
#define DT_F231  0x1C40
#define DT_F232  0x1C80

#define DT_F796  0x6308
#define DT_F797  0x6310
#define DT_F798  0x6320
#define DT_F799  0x6340

#define DT_F801  0x6401
#define DT_F802  0x6402
#define DT_F803  0x6404

#define APP_FRAME_RECV_HEADER 0
#define APP_FRAME_WAIT_REQUEST    1
#define APP_FRAME_RECV_FRAME      2
#define APP_FRAME_SEND_WAIT       0x00
#define APP_FRAME_SEND_ONGOING    0xAA
#define APP_FRAME_SEND_COMPLETED  0x80


INT16U  bin2_int16u(INT8U bin[2]);
INT8U  crc16_param(INT8U *data,INT16U size);


/////////////
#define PPPINITFCS16 0xffff /* Initial FCS value */
#define PPPGOODFCS16 0xf0b8 /* Good final FCS value */
/*
* FCS lookup table as calculated by the table generator.
*/
const INT16U  /*__MYOSTEXT */fcstab_Inner[256] = {
    0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
    0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
    0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
    0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
    0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
    0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
    0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
    0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
    0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
    0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
    0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
    0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
    0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
    0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
    0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
    0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
    0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
    0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
    0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
    0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,

    0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
    0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
    0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
    0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
    0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
    0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
    0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
    0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
    0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
    0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
    0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
    0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
};
#define OOP_POS_BEGIN						0       //起始符
#define OOP_POS_LEN							1       //长度
#define OOP_POS_CTRL						3       //控制码
#define OOP_POS_ADDR						4       //地址域
#define OOP_ADDR_LEN_MASK					0x0F    //地址长度掩码


//数据大小和数据长度大小
#define data_size unsigned char
#define data_length_size unsigned int
//crc32表 多项式三十二进制:0x4C11DB7 多项式方程
//式:x^21+x^18+x^17+x^11+x^7+x^6+x^5+x^4+x^2+x^1+1
static INT32U const crc32Table[256] = {
    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
    0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
    0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
    0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
    0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
    0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
    0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
    0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
    0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
    0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
    0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
    0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
    0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
    0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
    0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
    0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
    0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
    0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
    0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
    0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
    0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
    0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
    0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
    0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
    0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
    0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
    0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
    0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
    0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
    0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
    0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
    0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
    0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
};
INT32U code_crc32(data_size* data, data_length_size length);
bool decode_crc32(data_size* data, data_length_size length);
INT16S  str_find(INT8U *buffer,INT16U buflen,const INT8U *target,INT16U targetlen);
void mem_cpy_reverse(INT8U *dst, INT8U *src, INT16U len);
#endif // GLOBAL_VAR_H
